# coding=utf-8
import requests  # pip安装requests第三方库，然后引入
import json  # 引入json标准库，美化json输出

class Runmain:
    # 封装成函数
    def send_post(self, url, data):
        headers = {
            "content-type": "application/json"
        }
        result = requests.post(url=url, data=json.dumps(data), headers=headers).json()
        res = json.dumps(result, ensure_ascii=False, sort_keys=True, indent=2)
        print(res)

if __name__ == '__main__':
    url = 'http://127.0.0.1:5000/query'

    data = {
        "id": 11,
        "password": "201901020124",
        "username": "谭繁荣（改）",
    }

    run = Runmain()
    run.send_post(url, data)
